
//
//  MY_ReplenishmentAPI.m
//  MiYuan_iOS
//
//  Created by zhangyongbing on 2018/5/16.
//  Copyright © 2018年 zhangyongbing. All rights reserved.
//

#import "MY_ReplenishmentAPI.h"
NSString *const MYURLPath_ReplenishmentRetVendorInfo = @"/app/replenishment/%@/getVendorInfo";
NSString *const MYURLPath_Replenishment = @"/app/replenishment/addReplenishment";

@implementation MY_ReplenishmentAPI

+ (void)my_GetReplenishmentWithControlnumber:(NSString *)number
                           complationHandler:(OCJHttpResponseHander)handler {
    
    NSString *strupdataurl = [NSString stringWithFormat:MYURLPath_ReplenishmentRetVendorInfo,number];
    
    [[OCJNetWorkCenter sharedCenter] ocj_POSTWithUrlPath:strupdataurl parameters:nil andLodingType:OCJHttpLoadingTypeNone completionHandler:^(OCJBaseResponceModel *responseModel) {
        handler(responseModel);
        
        if (![responseModel.ocjStr_code isEqualToString:@"0"]) {
            [SGInfoAlert showInfo:responseModel.ocjStr_message
                          bgColor:[[UIColor blackColor] CGColor]
                           inView:[[UIApplication sharedApplication] keyWindow]
                         vertical:0.7];
        }
    }];
}

+ (void)my_AddReplenishmentWithPostData:(NSDictionary *)dic
                         complationHandler:(OCJHttpResponseHander)handler {
    NSMutableDictionary *mDic = [NSMutableDictionary dictionary];
    [mDic addEntriesFromDictionary:dic];
    
    [[OCJNetWorkCenter sharedCenter] ocj_POSTWithUrlPath:MYURLPath_Replenishment parameters:mDic andLodingType:OCJHttpLoadingTypeNone completionHandler:^(OCJBaseResponceModel *responseModel) {
        handler(responseModel);
        
        if (![responseModel.ocjStr_code isEqualToString:@"0"]) {
            [SGInfoAlert showInfo:responseModel.ocjStr_message
                          bgColor:[[UIColor blackColor] CGColor]
                           inView:[[UIApplication sharedApplication] keyWindow]
                         vertical:0.7];
        }
    }];
}

@end
